package org.vectrics.location;

import java.util.Collection;
import java.util.List;

import org.vectrics.domain.Domain;
import org.vectrics.user.Person;

/**
 * @author mmoore
 */
public interface LocationService {

    public Location createLocation(Domain domain, Location parentLocation, String name, String description,
            String typeCode, String abbreviation);

    public List<Location> findChildren(Location parent);

    public Location findLocation(Long id);

    public Collection findLocations(LocationCriteria criteria, int startIndex, int endIndex);

    public Collection findLocation(Domain domain, String name, String typeCode);

    public Location findLocation(Location location, Domain domain, String name, String typeCode);

    public void updateLocation(Long id, Domain domain, Long parentId, String name, String description);

    public void updateLocation(Location location);

    public void saveLocation(Location location);

    public void removeLocation(Person personWhoDidIt, Long locationId);

    public List<Location> findAllLocations(Domain domain);

    public List<Location> findAllLocations(Domain domain, String locationType);

    public Address findAddress(Long addressId);

    public Address createAddress();

    public void updateAddress(Address updateAddress);

    public void removeAddress(Address address);

    public List<Location> findTopLevelLocations(Domain domain);

    public Location findLocationForAddress(Address address);

    public Locale findLocale(String code);

    public void copyLocations(Domain fromDomain, Domain toDomain);

    public List<Location> findTopLevelLocations(Domain domain, String locationType);

    public boolean hasDomainLocation(Domain domain, Location location, String contextCode);

    public DomainLocation findDomainLocation(Domain domain, Location location, String contextCode);

    public List findLocationsForContextType(Domain domain, String contextCode);

    public void removeDomainLocation(Domain domain, String contextCode, Location location);

    public DomainLocation createDomainLocation(Domain domain, String contextCode, Location currentLocation);

    /**
     * Borra la location pasada por parametro, de la base de datos.
     * 
     * @param location
     */
    public void deleteLocation(Location location);

    /**
     * Busca las Locations por Codigo.
     * 
     * @param city
     * @param string
     * @return
     */
    public Collection findLocationForCode(String city, String string);

}
